package com.xkdx.guangguang.fragment.user;

import org.json.JSONArray;
import org.json.JSONObject;

import com.xkdx.guangguang.module.network.AbsModule;

public class UserResetPwdModule extends AbsModule {

	public RequsetVertifyCodeInfo getVertifyCode;
	JSONArray jsonArray;
	JSONObject jsonObj;

	@Override
	public void parseData() throws Exception {

		try {
			getVertifyCode = new RequsetVertifyCodeInfo();
			jsonArray = (JSONArray) result;
			jsonObj = (JSONObject) jsonArray.get(0);

			getVertifyCode = parserUserResetPwd(jsonObj
					.getJSONObject("Content"));
		} catch (Exception e) {
			throw e;
		}

	}

	private RequsetVertifyCodeInfo parserUserResetPwd(JSONObject userResetPwd) throws Exception{

		try {
			JSONObject stut = (JSONObject) userResetPwd.get("Result");

			getVertifyCode.setErrorCode(stut.getString("ErrorCode"));
			getVertifyCode.setMessage(stut.getString("Message"));
			getVertifyCode.setType(stut.getString("Type"));
			getVertifyCode.setStatus(stut.getString("Status"));

			if (stut.has("DetailInfo")) {
				JSONObject detail = (JSONObject) stut
						.getJSONObject("DetailInfo");
				if (detail.has("CheckSn") && detail.has("NowTime")) {
					getVertifyCode.setCheckSn(detail.getString("CheckSn"));
					getVertifyCode.setNowTime(detail.getString("NowTime"));
				}
			}
		} catch (Exception e) {
			throw e;
		}
		return getVertifyCode;
	}

	public class RequsetVertifyCodeInfo {

		private String Type;
		private String Status;
		private String ErrorCode;
		private String Message;
		private String NowTime;

		public String getNowTime() {
			return NowTime;
		}

		public void setNowTime(String nowTime) {
			NowTime = nowTime;
		}

		public String getCheckSn() {
			return CheckSn;
		}

		public void setCheckSn(String checkSn) {
			CheckSn = checkSn;
		}

		private String CheckSn;

		public String getType() {
			return Type;
		}

		public void setType(String type) {
			Type = type;
		}

		public String getStatus() {
			return Status;
		}

		public void setStatus(String status) {
			Status = status;
		}

		public String getErrorCode() {
			return ErrorCode;
		}

		public void setErrorCode(String errorCode) {
			ErrorCode = errorCode;
		}

		public String getMessage() {
			return Message;
		}

		public void setMessage(String message) {
			Message = message;
		}
	}
}
